package com.jiangdong.craft.util;

import com.jiangdong.craft.dto.ResponseDTO;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 返回ResponseDTO对象
 */
public class ResponseFactory {

    public static ResponseDTO getResponse(Object data, String message){
        ResponseDTO responseDTO = new ResponseDTO();
        responseDTO.setMessage(message);
        responseDTO.setData(data);
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        responseDTO.setResponseTime(df.format(new Date()));
        return responseDTO;
    }

}
